package com.bootdo.wx.service.impl;

import com.bootdo.common.utils.PageHelperUtils;
import com.bootdo.wx.dao.CmsMaterialDao;
import com.bootdo.wx.domain.CmsMaterialDO;
import com.bootdo.wx.service.CmsMaterialService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class CmsMaterialServiceImpl implements CmsMaterialService {
	@Autowired
	private CmsMaterialDao cmsMaterialDao;
	
	@Override
	public CmsMaterialDO get(String id){
		return cmsMaterialDao.get(id);
	}
	
	@Override
	public List<CmsMaterialDO> list(Map<String, Object> map){
		return cmsMaterialDao.list(map);
	}

	@Override
	public PageInfo<CmsMaterialDO> queryAll(Map<String,Object> map) {
		
		map.put("delFlag", "0");
		map.put("status", "0");
		PageHelperUtils.page(map);
		List<CmsMaterialDO> list =cmsMaterialDao.list(map);
		return null == list ? null : new PageInfo<CmsMaterialDO>(list);
//		return cmsMaterialDao.queryAll();
	}

	@Override
	public int count(Map<String, Object> map){
		return cmsMaterialDao.count(map);
	}
	
	@Override
	public int save(CmsMaterialDO cmsMaterial){
		return cmsMaterialDao.save(cmsMaterial);
	}
	
	@Override
	public int update(CmsMaterialDO cmsMaterial){
		return cmsMaterialDao.update(cmsMaterial);
	}
	
	@Override
	public int remove(String id){
		return cmsMaterialDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return cmsMaterialDao.batchRemove(ids);
	}
	
}
